<!doctype html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>更改昵称</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link href="css/iconfont.css" rel="stylesheet" />
		<link href="css/common.css" rel="stylesheet" />
		<link rel="stylesheet" href="css/edit-nickname.css"/>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">更改昵称</h1>
		    <span id="save" class="edit mui-pull-right">保存</span>
		</header>
		
	    <input type="text" name="nickname" id="nickname" value="" />
		
		<script src="js/mui.min.js"></script>
		<script type="text/javascript" src="js/jquery.min.js" ></script>
		<script type="text/javascript" src="js/html/common.js" ></script>
		<script src="js/public.js"></script>
		<script type="text/javascript">
			mui.init();
			mui.plusReady(function(){
				$('#nickname').val(getuid('nickname'));
				
				
/*				$.post(httpHost +'login/login', myForm, function (d) {

        if (d.code == 400) {
			login_suc(d);
			mui.back();
        } else {
            mui.toast(d.msg);
        }


    })*/
				
				
				$('#save').on('tap',function(){
					
					$.post(getHttp('account/nickname',true),{nickname:$('#nickname').val()},function(d){
					var comeFrom = plus.webview.currentWebview().comeFrom;
					if(d.code==200){
						//设置缓存
						window.localStorage.setItem('nickname',d.data);
						mui.toast(d.msg);						
						mui.back();
					}else{
						mui.toast(d.msg);
					}
					mui.fire(plus.webview.getWebviewById(comeFrom),'set-nickname',{
						
					nickname:d.data,
					})
					mui.fire(plus.webview.getWebviewById('me.html'),'page-load',null);
					//console.log(JSON.stringify(plus.webview.getWebviewById('me.html')));
//					
//					mui.toast('修改昵称成功')
//					
//					mui.back();
					})
				})
			})
			
			
		</script>
	</body>

</html>